<?php
/**
 * 增加自定义标记
 *
 * @version   $Id: mytag_add.php 1 15:35 2010年7月20日 $
 * @package   DedeCMS.Administrator
 * @founder   IT柏拉图, https://weibo.com/itprato
 * @author    DedeCMS团队
 * @copyright Copyright (c) 2007 - 2021, 上海卓卓网络科技有限公司 (DesDev, Inc.)
 * @license   http://help.dedecms.com/usersguide/license.html
 * @link      http://www.dedecms.com
 */
require dirname(__FILE__) . "/config.php";
CheckPurview('temp_Other');
require_once DEDEINC . "/typelink.class.php";
if (empty($dopost)) {
    $dopost = "";
}

if ($dopost === "save") {
    csrf_check();
    $tagname = trim($tagname);
    $starttime = GetMkTime($starttime);
    $endtime = GetMkTime($endtime);

    $query = "SELECT typeid FROM #@__mytag WHERE typeid='$typeid' AND tagname LIKE '$tagname'";
    $insterSQL = "INSERT INTO #@__mytag (typeid,tagname,timeset,starttime,endtime,normbody,expbody) VALUES ('$typeid','$tagname','$timeset','$starttime','$endtime','$normbody','$expbody')";
    if (is_array($dsql->GetOne($query))) {
        ShowMsg("在相同栏目下已经存在同名的标记！", "-1");
        exit();
    } 
    
    if ($dsql->ExecuteNoneQuery($insterSQL) === true) {
        ShowMsg("成功增加一个自定义标记！", "mytag_main.php");
    }
    exit();
   
}

$startDay = time();
$endDay = AddDay($startDay, 30);
$startDay = GetDateTimeMk($startDay);
$endDay = GetDateTimeMk($endDay);

$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN . '/templets/mytag_add.htm');
$dlist->display();
